<?php
/**
 * Created by PhpStorm.
 * User: tangchao
 * Date: 19-4-19
 * Time: 下午2:37
 */
namespace Lib;

class ObjectTest
{
    protected $array = [];

    //给不存在的属性赋值
    function __set($name, $value)
    {
        echo __METHOD__;
        $this->array[$name] = $value;
    }

    //读取不存在的属性
    function __get($name)
    {
        // TODO: Implement __get() method.
        echo __METHOD__;
        return $this->array[$name];
    }

    public function __call($name, $arguments)
    {
        echo __METHOD__;
        var_dump($name);
        var_dump($arguments);
    }

    public static function __callStatic($name, $arguments)
    {
        // TODO: Implement __callStatic() method.
        echo __METHOD__;
        var_dump($name);
        var_dump($arguments);
    }

    public function __toString()
    {
        // TODO: Implement __toString() method.
        return 'aaaa';
    }

    public function __invoke($param)
    {
        // TODO: Implement __invoke() method.
        var_dump($param);
        return 'invoke';
    }


}